<!DOCTYPE html>
<!--
  Copyright 2018 Google Inc.

  Permission is hereby granted, free of charge, to any person obtaining a copy
  of this software and associated documentation files (the "Software"), to deal
  in the Software without restriction, including without limitation the rights
  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  copies of the Software, and to permit persons to whom the Software is
  furnished to do so, subject to the following conditions:

  The above copyright notice and this permission notice shall be included in
  all copies or substantial portions of the Software.

  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  THE SOFTWARE.
-->
<html>
  <head>
    <meta charset="utf-8">
    <title>Tab - Material Components Catalog</title>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="icon" type="image/png" href="/images/logo_components_color_2x_web_48dp.png">
    <link rel="stylesheet" href="/assets/tab.css">
    <script src="/ready.js"></script>
    <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto+Mono">
    <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,400,500">
    <link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
  </head>

  <body class="mdc-typography">
    <header class="mdc-toolbar mdc-toolbar--fixed">
      <div class="mdc-toolbar__row">
        <section class="mdc-toolbar__section mdc-toolbar__section--align-start">
          <span class="catalog-back">
            <a href="/" class="mdc-toolbar__menu-icon"><i class="material-icons">&#xE5C4;</i></a>
          </span>
          <span class="mdc-toolbar__title catalog-title">Tab</span>
        </section>
      </div>
    </header>

    <main class="mdc-toolbar-fixed-adjust">
      <section class="hero demo">
        <button class="mdc-tab mdc-tab--stacked mdc-tab--active demo-tab" role="tab">
          <span class="mdc-tab__content">
            <span class="material-icons mdc-tab__icon">favorite</span>
            <span class="mdc-tab__text-label">Favorites</span>
            <span class="mdc-tab-indicator mdc-tab-indicator--active">
              <span class="mdc-tab-indicator__content mdc-tab-indicator__content--underline"></span>
            </span>
          </span>
          <span class="mdc-tab__ripple"></span>
        </button>
        <button class="mdc-tab mdc-tab--stacked demo-tab" role="tab">
          <span class="mdc-tab__content">
            <span class="material-icons mdc-tab__icon">phone</span>
            <span class="mdc-tab__text-label">Recents</span>
            <span class="mdc-tab-indicator">
              <span class="mdc-tab-indicator__content mdc-tab-indicator__content--underline"></span>
            </span>
          </span>
          <span class="mdc-tab__ripple"></span>
        </button>
        <button class="mdc-tab mdc-tab--stacked demo-tab" role="tab">
          <span class="mdc-tab__content">
            <span class="material-icons mdc-tab__icon">near_me</span>
            <span class="mdc-tab__text-label">Nearby</span>
            <span class="mdc-tab-indicator">
              <span class="mdc-tab-indicator__content mdc-tab-indicator__content--underline"></span>
            </span>
          </span>
          <span class="mdc-tab__ripple"></span>
        </button>
      </section>

      <div class="rtl-container">
        <h3>RTL</h3>
        <div>
          <input type="checkbox" id="rtl-checkbox"/>
          <label for="rtl-checkbox">Enabled</label>
        </div>
      </div>

      <section class="example">
        <h2>Tabs</h2>

        <h4>Text Label</h4>
        <div class="demo">
          <button class="mdc-tab mdc-tab--active demo-tab" role="tab">
            <span class="mdc-tab__content">
              <span class="mdc-tab__text-label">Favorites</span>
            </span>
            <span class="mdc-tab-indicator mdc-tab-indicator--active">
              <span class="mdc-tab-indicator__content mdc-tab-indicator__content--underline"></span>
            </span>
            <span class="mdc-tab__ripple"></span>
          </button>
          <button class="mdc-tab demo-tab" role="tab">
            <span class="mdc-tab__content">
              <span class="mdc-tab__text-label">Recents</span>
            </span>
            <span class="mdc-tab-indicator">
              <span class="mdc-tab-indicator__content mdc-tab-indicator__content--underline"></span>
            </span>
            <span class="mdc-tab__ripple"></span>
          </button>
          <button class="mdc-tab demo-tab" role="tab">
            <span class="mdc-tab__content">
              <span class="mdc-tab__text-label">Nearby</span>
            </span>
            <span class="mdc-tab-indicator">
              <span class="mdc-tab-indicator__content mdc-tab-indicator__content--underline"></span>
            </span>
            <span class="mdc-tab__ripple"></span>
          </button>
        </div>

        <br>
        <h4>Icon</h4>
        <div class="demo">
          <button class="mdc-tab mdc-tab--active demo-tab" role="tab">
            <span class="mdc-tab__content">
              <span class="mdc-tab__icon material-icons">favorite</span>
            </span>
            <span class="mdc-tab-indicator mdc-tab-indicator--active">
              <span class="mdc-tab-indicator__content mdc-tab-indicator__content--underline"></span>
            </span>
            <span class="mdc-tab__ripple"></span>
          </button>
          <button class="mdc-tab demo-tab" role="tab">
            <span class="mdc-tab__content">
              <span class="mdc-tab__icon material-icons">phone</span>
            </span>
            <span class="mdc-tab-indicator">
              <span class="mdc-tab-indicator__content mdc-tab-indicator__content--underline"></span>
            </span>
            <span class="mdc-tab__ripple"></span>
          </button>
          <button class="mdc-tab demo-tab" role="tab">
            <span class="mdc-tab__content">
              <span class="mdc-tab__icon material-icons">near_me</span>
            </span>
            <span class="mdc-tab-indicator">
              <span class="mdc-tab-indicator__content mdc-tab-indicator__content--underline"></span>
            </span>
            <span class="mdc-tab__ripple"></span>
          </button>
        </div>

        <br>
        <h4>Text Label and Icon</h4>
        <div class="demo">
          <button class="mdc-tab mdc-tab--active demo-tab" role="tab">
            <span class="mdc-tab__content">
              <span class="mdc-tab__icon material-icons">favorite</span>
              <span class="mdc-tab__text-label">Favorites</span>
            </span>
            <span class="mdc-tab-indicator mdc-tab-indicator--active">
              <span class="mdc-tab-indicator__content mdc-tab-indicator__content--underline"></span>
            </span>
            <span class="mdc-tab__ripple"></span>
          </button>
          <button class="mdc-tab demo-tab" role="tab">
            <span class="mdc-tab__content">
              <span class="mdc-tab__icon material-icons">phone</span>
              <span class="mdc-tab__text-label">Recent</span>
            </span>
            <span class="mdc-tab-indicator">
              <span class="mdc-tab-indicator__content mdc-tab-indicator__content--underline"></span>
            </span>
            <span class="mdc-tab__ripple"></span>
          </button>
          <button class="mdc-tab demo-tab" role="tab">
            <span class="mdc-tab__content">
              <span class="mdc-tab__icon material-icons">near_me</span>
              <span class="mdc-tab__text-label">Nearby</span>
            </span>
            <span class="mdc-tab-indicator">
              <span class="mdc-tab-indicator__content mdc-tab-indicator__content--underline"></span>
            </span>
            <span class="mdc-tab__ripple"></span>
          </button>
        </div>

        <br>
        <h4>Stacked Text Label and Icon</h4>
        <div class="demo">
          <button class="mdc-tab mdc-tab--stacked mdc-tab--active demo-tab" role="tab">
            <span class="mdc-tab__content">
              <span class="mdc-tab__icon material-icons">favorite</span>
              <span class="mdc-tab__text-label">Favorites</span>
            </span>
            <span class="mdc-tab-indicator mdc-tab-indicator--active">
              <span class="mdc-tab-indicator__content mdc-tab-indicator__content--underline"></span>
            </span>
            <span class="mdc-tab__ripple"></span>
          </button>
          <button class="mdc-tab mdc-tab--stacked demo-tab" role="tab">
            <span class="mdc-tab__content">
              <span class="mdc-tab__icon material-icons">phone</span>
              <span class="mdc-tab__text-label">Recent</span>
            </span>
            <span class="mdc-tab-indicator">
              <span class="mdc-tab-indicator__content mdc-tab-indicator__content--underline"></span>
            </span>
            <span class="mdc-tab__ripple"></span>
          </button>
          <button class="mdc-tab mdc-tab--stacked demo-tab" role="tab">
            <span class="mdc-tab__content">
              <span class="mdc-tab__icon material-icons">near_me</span>
              <span class="mdc-tab__text-label">Nearby</span>
            </span>
            <span class="mdc-tab-indicator">
              <span class="mdc-tab-indicator__content mdc-tab-indicator__content--underline"></span>
            </span>
            <span class="mdc-tab__ripple"></span>
          </button>
        </div>

        <br>
        <h4>Text Label Width-Matching Indicator</h4>
        <div class="demo">
          <button class="mdc-tab mdc-tab--active demo-tab" role="tab">
            <span class="mdc-tab__content">
              <span class="mdc-tab__text-label">Favorites</span>
              <span class="mdc-tab-indicator mdc-tab-indicator--active">
                <span class="mdc-tab-indicator__content mdc-tab-indicator__content--underline"></span>
              </span>
            </span>
            <span class="mdc-tab__ripple"></span>
          </button>
          <button class="mdc-tab demo-tab" role="tab">
            <span class="mdc-tab__content">
              <span class="mdc-tab__text-label">Recent</span>
              <span class="mdc-tab-indicator">
                <span class="mdc-tab-indicator__content mdc-tab-indicator__content--underline"></span>
              </span>
            </span>
            <span class="mdc-tab__ripple"></span>
          </button>
          <button class="mdc-tab demo-tab" role="tab">
            <span class="mdc-tab__content">
              <span class="mdc-tab__text-label">Nearby</span>
              <span class="mdc-tab-indicator">
                <span class="mdc-tab-indicator__content mdc-tab-indicator__content--underline"></span>
              </span>
            </span>
            <span class="mdc-tab__ripple"></span>
          </button>
        </div>

        <br>
        <h4>Text Label with Icon Indicator</h4>
        <div class="demo">
          <button class="mdc-tab mdc-tab--active demo-tab" role="tab">
            <span class="mdc-tab__content">
              <span class="mdc-tab__text-label">Favorites</span>
            </span>
            <span class="mdc-tab-indicator mdc-tab-indicator--fade mdc-tab-indicator--active">
              <span class="mdc-tab-indicator__content mdc-tab-indicator__content--icon material-icons">crop_square</span>
            </span>
            <span class="mdc-tab__ripple"></span>
          </button>
          <button class="mdc-tab demo-tab" role="tab">
            <span class="mdc-tab__content">
              <span class="mdc-tab__text-label">Recents</span>
            </span>
            <span class="mdc-tab-indicator mdc-tab-indicator--fade">
              <span class="mdc-tab-indicator__content mdc-tab-indicator__content--icon material-icons">panorama_fish_eye</span>
            </span>
            <span class="mdc-tab__ripple"></span>
          </button>
          <button class="mdc-tab demo-tab" role="tab">
            <span class="mdc-tab__content">
              <span class="mdc-tab__text-label">Nearby</span>
            </span>
            <span class="mdc-tab-indicator mdc-tab-indicator--fade">
              <span class="mdc-tab-indicator__content mdc-tab-indicator__content--icon material-icons">change_history</span>
            </span>
            <span class="mdc-tab__ripple"></span>
          </button>
        </div>
      </section>

      <section class="example">
        <h2>Customization</h2>
        <section class="custom-demo demo">
          <button class="mdc-tab mdc-tab--stacked mdc-tab--active demo-tab custom-tab" role="tab">
            <span class="mdc-tab__content">
              <span class="material-icons mdc-tab__icon">favorite</span>
              <span class="mdc-tab__text-label">Favorites</span>
              <span class="mdc-tab-indicator mdc-tab-indicator--active custom-tab-indicator">
                <span class="mdc-tab-indicator__content mdc-tab-indicator__content--underline"></span>
              </span>
            </span>
            <span class="mdc-tab__ripple"></span>
          </button>
          <button class="mdc-tab mdc-tab--stacked demo-tab custom-tab" role="tab">
            <span class="mdc-tab__content">
              <span class="material-icons mdc-tab__icon">phone</span>
              <span class="mdc-tab__text-label">Recents</span>
              <span class="mdc-tab-indicator custom-tab-indicator">
                <span class="mdc-tab-indicator__content mdc-tab-indicator__content--underline"></span>
              </span>
            </span>
            <span class="mdc-tab__ripple"></span>
          </button>
          <button class="mdc-tab mdc-tab--stacked demo-tab custom-tab" role="tab">
            <span class="mdc-tab__content">
              <span class="material-icons mdc-tab__icon">near_me</span>
              <span class="mdc-tab__text-label">Nearby</span>
              <span class="mdc-tab-indicator custom-tab-indicator">
                <span class="mdc-tab-indicator__content mdc-tab-indicator__content--underline"></span>
              </span>
            </span>
            <span class="mdc-tab__ripple"></span>
          </button>
        </section>
      </section>
    </main>

    <script src="/assets/material-components-web.js" async></script>
    <script src="/assets/common.js" async></script>
    <script>
      demoReady(function() {
        function initDemo(demoRoot) {
          var demoTabs = demoRoot.querySelectorAll('.mdc-tab');
          var activeTab;
          [].forEach.call(demoTabs, function (tabEl) {
            var tab = new mdc.tab.MDCTab(tabEl);
            if (tab.active) {
              activeTab = tab;
            }

            tabEl.addEventListener('MDCTab:interacted', function(evt) {
              // Early exit if the interacted tab is the currently active tab
              if (activeTab === evt.detail.tab) {
                return;
              }

              activeTab.deactivate();
              evt.detail.tab.activate(activeTab.computeIndicatorClientRect());
              activeTab = evt.detail.tab;
            });
          });
        }

        var demos = document.querySelectorAll('.demo');
        [].forEach.call(demos, initDemo);

        var rtlControls = document.getElementById('rtl-checkbox');
        rtlControls.addEventListener('change', function(event) {
          document.body.setAttribute('dir', event.currentTarget.checked ? 'rtl': 'ltr');
        });
      });
    </script>
  </body>
</html>
